package com.app.presenter;

import com.app.model.LoadListener;
import com.app.model.UserModelImpl;
import com.app.model.UserModel;
import com.app.viewImpl.MainView;

/**
 * Created by ${zyj} on 2016/3/25.
 */
public class UserPresenterImpl implements UserPresenter , LoadListener  {

    private MainView mainView ;
    private UserModel userModel ;

    public UserPresenterImpl(MainView mainView){
        this.mainView = mainView  ;
        this.userModel = new UserModelImpl() ;
    }

    @Override
    public void loadData(String name, String pass) {
        userModel.login(name, pass, this );
    }

    @Override
    public void start() {
        mainView.start();
    }

    @Override
    public void end() {
        mainView.end();
    }

    @Override
    public void success(Object object) {
        mainView.loginSuccess( object );
    }

    @Override
    public void fail() {
        mainView.loginFail();
    }
}
